"use strict";
module.exports = (sequelize, DataTypes) => {
  const goods = sequelize.define(
    "goods",
    {
      title: DataTypes.STRING,
      price: DataTypes.INTEGER,
      desc: DataTypes.STRING,
      img: DataTypes.STRING,
      view: DataTypes.INTEGER,
      type: DataTypes.STRING
    },
    {}
  );
  goods.associate = function(models) {
    // associations can be defined here
    goods.belongsToMany(models["order"], {
      through: "ordergoods",
      foreignKey: "goodsId"
    });
  };
  return goods;
};
